<?php
class DbModel extends Object
{

	/**
	 * Hold an instance of the class
	 * @var ConnectModel
	 */
	private static $_instance = null;

	/**
	 * A private constructor
	 * Prevents direct creation of object
	 */
	private function __construct()
	{
		$this->_init();
	}

	/**
	 * The singleton method
	 * @return ConnectModel
	 */
	public static function getInstance()
	{
		if (!self::$_instance instanceof self)
			self::$_instance = new self;

		return self::$_instance;
	}

	/**
	 * Method to connect to a database
	 */
	public static function connect()
	{
		dibi::connect(Environment::getConfig()->database);
	}

	/**
	 * Method to disconnect to a database
	 */
	public static function disconnect()
	{
		dibi::disconnect();
	}

}